@extends('layouts.app')

@section('content')
  <div class="main-content">
		<div class="search_inp">
			<table width="100%" border="1" class="table_search">
				<thead>
					<tr>
						<th colspan="6">
							<span>查询条件</span>
						</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td width="13.33%" align="right"><label>单位名称：</label></td>
						<td width="20%"><input type="text" class="w150" name="name" placeholder="请输入单位关键字"/></td>
						<td width="13.33%" align="right"><label>风险度评分：</label></td>
						<td width="20%"><input type="text" class="w150" name="frdb_name" placeholder="请输入风险度评分"/></td>
						<td width="13.33%" align="right"><label>企业类型：</label></td>
						<td width="20%">
							<select name="type" class="w150">
								<option value="">请选择企业类型</option>
								
							</select>
						</td>
					</tr>
					<tr>
						<td width="13.33%" align="right"><label>企业信用评分：</label></td>
						<td width="20%">
							<select name="jibie" class="w150">
								<option value="">请选择分数</option>
								<option value="0">优秀</option>
								<option value="1">良好</option>
								<option value="2">合格</option>
								<option value="3">不合格</option>
							</select>
						</td>
						<td width="13.33%" align="right"></td>
						<td width="20%">
							<input type="hidden" name="city" value=""/>
							<input type="hidden" name="area" value=""/>
							<input type="hidden" name="org_id" value=""/>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px" onclick="doSearch()">查询</a>
						</td>
						<td></td><td></td>
					</tr>
				</tbody>
			</table>
		</div>
			<div class="btn-toolbar list-toolbar">
			<div class="form-all mg_t30">
				<div id="tb">
					<a class="easyui-linkbutton" iconCls="icon-add" onclick="add()" plain="true">新增</a>
					<a class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">编辑</a>
					<a class="easyui-linkbutton" iconCls="icon-large-smartart" plain="true" onclick="export_unit()">导出</a>
				</div>
				<table id="dg" title="企业综合考评列表" class="easyui-datagrid" style="width:100%;height:600px"
						data-options="rownumbers:true,singleSelect:true,pagination:true,pageSize:20,url:'http://nb.yntosite.com/json/kaoping2.json',method:'get',toolbar:'#tb'">
					<thead>
						<tr>
							<th data-options="field:'city'" width="11%" align="center">市</th>
							<th data-options="field:'area'" width="11%" align="center">区</th>
							<th data-options="field:'name'" width="11%" align="center">名称</th>
							<th data-options="field:'address'" width="11%" align="center">地址</th>
							<th data-options="field:'type'" width="11%" align="center">企业类型</th>
							<th data-options="field:'score'" width="11%" align="center" formatter="formatPrice">企业信用评分</th>
							<th data-options="field:'number'" width="5%" align="center">警综信息</th>
							<th data-options="field:'number2'" width="5%" align="center">风险度评分</th>
							<th data-options="field:'evaluation'" width="24%" align="center">评估</th>
						</tr>
					</thead>
				</table>
		  </div>
		</div>
    </div>
    <!--新增-->
	<div id="w" class="easyui-window" closed="true" style="overflow: hidden;"></div>
	<div id="jwd" class="easyui-window" closed="true" title="新增" data-options="iconCls:'icon-save'" style="width:800px;height:600px;padding:10px;">
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=hrVnXxLAGVr6QZ0rt9MaxU8bBkwKzyQC"></script>
	</div>
	 <!--分数-->
    <script type="text/javascript">
        function formatPrice(val,row){
			if (val == '优秀'){
				return '<span style="color:green;">'+val+'</span>';
			}else if(val == '良好'){
				return '<span style="color:green;">'+val+'</span>';
			}else if(val == '合格'){
				return '<span style="color:orange;">'+val+'</span>';
			}else{
				return '<span style="color:red;">'+val+'</span>';
			} 
		}

    </script>
    <script type="text/javascript" src="{{ URL::asset('/') }}js/weizhi.js"></script>
    <script type="text/javascript">
    	function add(){
    		var shuz = fb2();
			$('#w').window({
				title: "新增",
				href: 'addkp',
				width:shuz[0],
				height:shuz[1],
				top:shuz[2],
				left:shuz[3],
				modal:true,
				closed: false,
				minimizable:false,
			});
		}
		
		$("#dg").datagrid({
			onRowContextMenu: function (e, rowIndex, rowData) {
				e.preventDefault();
				$(this).datagrid("clearSelections");
				$(this).datagrid("selectRow", rowIndex);
				$('#menu').menu('show', {
					left: e.pageX,
					top: e.pageY
				});
				e.preventDefault();
			}
		});
		$("#dg").datagrid({
			onDblClickRow: function (index, row) {
				add();
			}
		});
    </script>
  <script>
	  $(document).ready(function(){
		  var winHeight =  window.screen.height;
		  var winWidth = 	window.screen.width;
		  if(winWidth == 1024){
			  $('#taby').css('height',465+'px');
			  $('#taby').find('iframe').css('height',436+'px');
		  }else if(winWidth == 1280){
			  $('#taby').css('height',465+'px');
			  $('#taby').find('iframe').css('height',436+'px');
		  }else if(winWidth == 1366){
			  $('#taby').css('height',465+'px'); $('#taby').find('iframe').css('min-height',436+'px');
		  }else if(winWidth == 1920){
			  $('#taby').css('height',625+'px');
			  $('#taby').find('iframe').css('min-height',596+'px');
		  }else{
			  $('#taby').css('height',465+'px');
			  $('#taby').find('iframe').css('min-height',436+'px');
		  }
	  })

	  function load_city_data_from_menu($id){
		  $('#dg').datagrid('load',{
			  city: $id,
		  });
		  $("input[name='city']").val($id);
		  $("input[name='area']").val('');
		  $("input[name='org_id']").val('');
	  }

	  function load_area_data_from_menu($id){
		  $('#dg').datagrid('load',{
			  area: $id,
		  });
		  $("input[name='city']").val('');
		  $("input[name='area']").val($id);
		  $("input[name='org_id']").val('');
	  }
	  function load_org_data_from_menu($id){
		  $('#dg').datagrid('load',{
			  org_id: $id,
		  });
		  $("input[name='city']").val('');
		  $("input[name='area']").val('');
		  $("input[name='org_id']").val($id);
	  }
  </script>
@stop